//type:success, error, info
//time:ms
function tipswin (type, data, time){

    var lunbo=document.createElement("div")
    
   if(type == "success") {
       lunbo.style.backgroundColor = "#009900"
   } else if(type == "error") {
       lunbo.style.backgroundColor = "#990000"
   } else if(type == "info") {
       lunbo.style.backgroundColor = "#5599FF"
   } else {
       console.log("入参type错误")
       return
   }

   lunbo.id="lunbo"
   lunbo.style.position = "absolute"
   lunbo.style.width = "200px"
   lunbo.style.height = "60px"
   lunbo.style.marginLeft = "-100px"
   lunbo.style.marginTop = "-30px"
   lunbo.style.left = "50%"
   lunbo.style.top = "30%"
   lunbo.style.color = "white"
   lunbo.style.fontSize = "25px"
   lunbo.style.borderRadius = "20px"
   lunbo.style.textAlign="center"
   lunbo.style.lineHeight="60px"

   if(document.getElementById("lunbo")==null){
       document.body.appendChild(lunbo)
       lunbo.innerHTML=data
       setTimeout(function(){
           document.body.removeChild(lunbo)
       } ,time)
   }
}
function success(data, time){
    tipswin("success",data, time)
}
function error(data, time){
    tipswin("error",data, time)
}
function info(data, time){
    tipswin("info",data, time)
}
export default{
	success:success,
    error:error,
    info:info
}